Exemplo n.º 1
0
 def test_can_retrieve_valid_index(self):
     past_team = Page('data', DATA)
     one = past_team.get(0)
     self.assertEqual(one.name, "Facebook")
     self.assertEqual(one.permalink, "facebook")
     self.assertEqual(one.api_path, "organizations/facebook")
     self.assertEqual(one.web_path, "organization/facebook")
Exemplo n.º 2
0
 def test_can_retrieve_valid_index(self):
     past_team = Page('data', DATA)
     one = past_team.get(0)
     self.assertEqual(one.name, "Facebook")
     self.assertEqual(one.permalink, "facebook")
     self.assertEqual(one.api_path, "organizations/facebook")
     self.assertEqual(one.web_path, "organization/facebook")
Exemplo n.º 3
0
    def test_passing_in_bad_key(self):
        past_team = Page('data', DATA)
        with self.assertRaises(TypeError):
            past_team['bad']

        self.assertEqual(past_team[0], past_team.get(0))
Exemplo n.º 4
0
 def test_retrieving_out_of_bound_index(self):
     past_team = Page('data', DATA)
     with self.assertRaises(IndexError):
         past_team.get(2)
Exemplo n.º 5
0
 def test_can_retrieve_valid_index(self):
     past_team = Page('data', DATA)
     one = past_team.get(0)
     self.assertEqual(one.name, "Example")
     self.assertEqual(one.permalink, "example")
Exemplo n.º 6
0
 def test_iterate(self):
     past_team = Page('data', DATA)
     members = [member for member in past_team]
     self.assertEqual(1, len(members))
     self.assertEqual(past_team[0], members[0])
Exemplo n.º 7
0
    def test_passing_in_bad_key(self):
        past_team = Page('data', DATA)
        with self.assertRaises(TypeError):
            past_team['bad']

        self.assertEqual(past_team[0], past_team.get(0))
Exemplo n.º 8
0
 def test_retrieving_out_of_bound_index(self):
     past_team = Page('data', DATA)
     with self.assertRaises(IndexError):
         past_team.get(2)
Exemplo n.º 9
0
 def test_can_retrieve_valid_index(self):
     past_team = Page('data', DATA)
     one = past_team.get(0)
     self.assertEqual(one.name, "Example")
     self.assertEqual(one.permalink, "example")