예제 #1
0
 def test_return_msg_on_success(self, post):
     data = {'email': '*****@*****.**', 'password': '******',
             'same_password_again': 'abc123'}
     request = self.factory.post('/signup', data)
     post.return_value = Mock(status_code=201)
     response = Signup.as_view()(request)
     expected = 'User "{0}" successfully created!'.format(data["email"])
     self.assertEqual(expected, response.context_data["message"])
예제 #2
0
 def test_should_validate_data_from_post(self):
     data = {'email': '', 'password': '', 'same_password_again': ''}
     request = self.factory.post('/signup', data)
     response = Signup().post(request)
     form = response.context_data['signup_form']
     self.assertIn(u'This field is required.', form.errors['email'])
     self.assertIn(u'This field is required.', form.errors['password'])
     self.assertIn(u'This field is required.',
                   form.errors['same_password_again'])
예제 #3
0
 def test_post_sends_to_tsuru_with_args_expected(self, post):
     data = {'email': '*****@*****.**', 'password': '******',
             'same_password_again': 'abc123'}
     request = self.factory.post('/signup', data)
     Signup().post(request)
     self.assertEqual(1, post.call_count)
     post.assert_called_with(
         '%s/users' % settings.TSURU_HOST,
         data='{"password": "******", "email": "*****@*****.**"}')
예제 #4
0
 def setUp(self):
     self.factory = RequestFactory()
     self.request = self.factory.get('/')
     self.response = Signup().get(self.request)
     self.response_mock = Mock()
예제 #5
0
파일: urls.py 프로젝트: hfeeki/abyss
class TextPlainView(TemplateView):
    def render_to_response(self, context, **kwargs):
        return super(TextPlainView, self).render_to_response(
            context, content_type='text/plain', **kwargs)

urlpatterns = patterns('',
    url(r'^robots\.txt$', TextPlainView.as_view(template_name='robots.txt')),
    url(r'^favicon\.ico$', RedirectView.as_view(url='/static/img/favicon.ico')),
    url(r'^$', Login.as_view(), name='login'),

    url(r'^login$', Login.as_view(), name='login'),
    url(r'^logout$', Logout.as_view(), name='logout'),
    url(r'^team/$', Team.as_view(), name='team'),
    url(r'^key/$', Key.as_view(), name='token'),
    url(r'^signup$', Signup.as_view(), name='signup'),

    url(r'^apps/$', ListApp.as_view(), name='list-app'),
    url(r'^apps/create/$', CreateApp.as_view(), name='create-app'),
    url(r'^app/run/$', Run.as_view(), name='run'),
    url(r'^app/(?P<app_name>[\w-]+)/$', AppDetail.as_view(), name='detail-app'),
    url(r'^app/(?P<name>[\w-]+)/remove/$', RemoveApp.as_view(), name='remove_app'),
    url(r'^app/(?P<app_name>[\w-]+)/log/$', AppLog.as_view(), name='app_log'),
    url(r'^app/(?P<app_name>[\w-]+)/env/$', AppEnv.as_view(), name='get-env'),
    url(r'^app/(?P<app_name>[\w-]+)/teams/$', AppTeams.as_view(), name='app-teams'),
    url(r'^app/(?P<app_name>[\w-]+)/team/add/$', AppAddTeam.as_view(), name='app-add-team'),
    url(r'^envs/$', "auth.views.env_vars", name='envs'),
)

urlpatterns += staticfiles_urlpatterns()