示例#1
0
文件: test_site.py 项目: yola/yolapy
    def test_instantiates_site_with_attrs_from_service(self):
        self.yola.get_site.return_value = {'name': 'site name', 'id': '456'}

        site = Site.get('456')

        self.yola.get_site.assert_called_once_with('456')
        self.assertEqual(site.name, 'site name')
        self.assertEqual(site.id, '456')
示例#2
0
文件: test_site.py 项目: yola/yolapy
    def test_instantiates_site_with_attrs_from_service(self):
        self.yola.get_site.return_value = {'name': 'site name', 'id': '456'}

        site = Site.get('456')

        self.yola.get_site.assert_called_once_with('456')
        self.assertEqual(site.name, 'site name')
        self.assertEqual(site.id, '456')
示例#3
0
文件: test_site.py 项目: yola/yolapy
    def setUp(self):
        super(TestSiteList, self).setUp()

        self.yola.list_sites.return_value = {'results': [
            {'id': '1'}, {'id': '2'},
        ]}

        self.sites = Site.list(user_id='user123')
        _, self.service_kwargs = self.yola.list_sites.call_args
示例#4
0
文件: test_site.py 项目: yola/yolapy
    def setUp(self):
        super(TestSiteList, self).setUp()

        self.yola.list_sites.return_value = {
            'results': [
                {
                    'id': '1'
                },
                {
                    'id': '2'
                },
            ]
        }

        self.sites = Site.list(user_id='user123')
        _, self.service_kwargs = self.yola.list_sites.call_args
示例#5
0
 def test_list_sites_using_model(self):
     sites = Site.list()
     site_ids = [s.id for s in sites]
     self.assertIn(self.site['id'], site_ids)
示例#6
0
文件: test_site.py 项目: yola/yolapy
 def test_true_if_publishing_state_is_published(self):
     site = Site(publishing_data={'state': SiteStates.PUBLISHED})
     self.assertTrue(site.is_published)
示例#7
0
文件: test_site.py 项目: yola/yolapy
 def test_false_if_publishing_state_is_not_published(self):
     site = Site(publishing_data={'state': 999})
     self.assertFalse(site.is_published)
示例#8
0
文件: test_site.py 项目: yola/yolapy
 def test_false_if_no_publishing_data(self):
     site = Site()
     self.assertFalse(site.is_published)
示例#9
0
文件: test_site.py 项目: yola/yolapy
 def test_instantiates_list_of_sites_with_attrs_from_service(self):
     self.assertEqual(len(self.sites), 2)
     self.assertIn(Site(id='1'), self.sites)
     self.assertIn(Site(id='2'), self.sites)
示例#10
0
文件: test_site.py 项目: yola/yolapy
 def test_sets_init_kwargs_as_attributes(self):
     site = Site(name='my site', id='123')
     self.assertEqual(site.name, 'my site')
     self.assertEqual(site.id, '123')