1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
7 from telemetry
import user_story
9 class UserStoryFoo(user_story
.UserStory
):
13 class UserStoryTest(unittest
.TestCase
):
14 def testUserStoriesHaveDifferentIds(self
):
15 u0
= user_story
.UserStory('foo')
16 u1
= user_story
.UserStory('bar')
17 self
.assertNotEqual(u0
.id, u1
.id)
19 def testNamelessUserStoryDisplayName(self
):
21 self
.assertEquals('UserStoryFoo', u
.display_name
)
23 def testNamedUserStoryDisplayName(self
):
24 u
= UserStoryFoo('Bar')
25 self
.assertEquals('Bar', u
.display_name
)
27 def testUserStoryFileSafeName(self
):
28 u
= UserStoryFoo('Foo Bar:Baz~0')
29 self
.assertEquals('Foo_Bar_Baz_0', u
.file_safe_name
)
31 def testNamelessUserStoryAsDict(self
):
32 u
= user_story
.UserStory()
34 self
.assertEquals(u_dict
['id'], u
.id)
35 self
.assertNotIn('name', u_dict
)
37 def testNamedUserStoryAsDict(self
):
38 u
= user_story
.UserStory('Foo')
40 self
.assertEquals(u_dict
['id'], u
.id)
41 self
.assertEquals('Foo', u_dict
['name'])