示例#1
0
    def test_should_contain_user_representation_when_authorized(self):
        user = build_dummy_user()
        context = build_authorized_context(user=user)

        resource = buildresource.application(context)

        self.assertEqual(resource.data.user_repr.data.first_name, user.first_name)
示例#2
0
    def test_when_a_current_page_is_set_it_should_be_linked_and_embedded(self):
        context = build_unauthorized_context()
        current = FakeCurrent()
        current.ref = 'the link'
        current.data = 'just to know'

        resource = buildresource.application(context, current)

        current_link = resource.links['current']
        self.assertEqual(current_link, 'the link')
        self.assertEqual(resource.embedded[current_link].data, 'just to know')
示例#3
0
    def test_should_have_login_action_when_NOT_authorized(self):
        context = build_unauthorized_context()

        resource = buildresource.application(context)

        self.assertIn('login', resource.actions)