예제 #1
0
    def test_home_page_can_save_POST_request(self):
        request = self.create_item_post_request('New Item')

        home_page(request)

        items = Item.objects.all()
        self.assertEqual(items.count(), 1)
        self.assertEqual(items[0].text, 'New Item')
예제 #2
0
파일: tests.py 프로젝트: mvhbe/tdd-todo
    def test_home_page_can_save_a_post_request(self):
        self.request.method = 'POST'
        self.request.POST["item_text"] = 'A new list item'

        home_page(self.request)

        self.assertEqual(Item.objects.count(), 1)
        newItem = Item.objects.first()
        self.assertEqual(newItem.text, 'A new list item')
예제 #3
0
    def test_home_page_can_save_a_POST_request(self):
        request = HttpRequest() 
        request.method = 'POST'
        request.POST['item_text'] = 'A new list item'

        home_page(request)

        self.assertEqual(Item.objects.count(), 1)
        new_item = Item.objects.first()
        self.assertEqual(new_item.text, 'A new list item')
예제 #4
0
파일: tests.py 프로젝트: dariosul/scratch
    def test_home_page_can_save_a_POST_request(self):
        request = HttpRequest()
        request.method = "POST"
        item_text = "A new list item"
        request.POST["item_text"] = item_text

        home_page(request)

        self.assertEqual(Item.objects.count(), 1)
        new_item = Item.objects.first()
        self.assertEqual(new_item.text, item_text)
예제 #5
0
파일: tests.py 프로젝트: HassenPy/tdd-goat
    def test_home_page_can_save_a_POST_request(self):
        request = HttpRequest()
        request.method = 'POST'
        request.POST['item_text'] = "A new list item"

        home_page(request)

        items_list = Item.objects.all()
        self.assertEqual(items_list.count(), 1)
        self.assertIn(request.POST['item_text'],
                      [item.text for item in items_list]
                      )
예제 #6
0
 def test_home_page_uses_home_template(self):
     request = HttpRequest()
     response = home_page(request)
     csrf_regex = r'<input[^>]+csrfmiddlewaretoken[^>]+>'
     observed_content = re.sub(csrf_regex,'',response.content.decode('utf8'))
     expected_content = render_to_string('home.html')
     self.assertEqual(observed_content, expected_content)
예제 #7
0
 def test_home_page_returns_correct_html(self):
     request = HttpRequest()
     response = home_page(request)
     expected_html = render_to_string('home.html')
     # note: conent is in raw bytes
     # use decode() to convert bytes into python
     self.assertEqual(response.content.decode(), expected_html)
예제 #8
0
 def test_home_page_displays_all_list_items(self):
     Item.objects.create(text='itemey 1')
     Item.objects.create(text='itemey 2')
     request = HttpRequest()
     response = home_page(request)
     self.assertIn('itemey 1',response.content.decode())
     self.assertIn('itemey 2',response.content.decode())
예제 #9
0
 def test_home_page_renders_home_template(self):
     request = HttpRequest()
     response = home_page(request)
     #Verify extra characters that might come along
     #print(repr(response.content))
     expected_html = render_to_string('home.html', {'form': ItemForm()})
     self.assertMultiLineEqual(response.content.decode(), expected_html)
예제 #10
0
	def test_home_page_returns_correct_html(self):
		request = HttpRequest()
		response = home_page(request)
		
		# view 함수(home_page)에서 리턴된 결과와 html 결과가 같은 지 테스트
		expected_html = render_to_string('home.html')
		self.assertEqual(response.content.decode(), expected_html)
예제 #11
0
파일: tests.py 프로젝트: AK-1121/superlists
 def test_home_page_returns_correct_html(self):
     request = HttpRequest()
     response = home_page(request)
     expected_html = render_to_string('home.html')
     #print("expected_html:",len(expected_html))
     #print("response: ", type(response))
     self.assertEqual(response.content.decode(), expected_html)
예제 #12
0
	def test_home_page_returns_correct_html(self):
		request = HttpRequest()
		response = home_page(request)
		expected_html = render_to_string('home.html')
		self.assertTrue(response.content.strip().startswith(b'<html>'))
		self.assertEqual(response.content.decode(), expected_html)
		self.assertTrue(response.content.strip().endswith(b'</html>'))
예제 #13
0
	def test_home_page_returns_correct_html(self):
		request = HttpRequest()
		response = home_page(request)
		expected_html = render_to_string('home.html',
			{ 'comment': 'Yey, waktunya berlibur' }
		)
		self.assertEqual(response.content.decode(), expected_html)
예제 #14
0
파일: tests.py 프로젝트: mmcross/mysite
	def test_home_page_returns_correct_html(self):
		request = HttpRequest()
		response = home_page(request)
		c = {}
		c.update(csrf(request))
		expected_html = render_to_string('home.html',c)
		self.assertEqual(response.content.decode(),expected_html)				
예제 #15
0
    def test_comment_partial(self):
        _list = List.objects.create()
        Item.objects.create(text="test 1", list=_list)

        request = HttpRequest()
        response = home_page(request)
        self.assertIn("sibuk tapi santai", response.content.decode())
예제 #16
0
    def test_home_page_should_redirect_after_POST(self):
        request = self.create_item_post_request('New Item')

        response = home_page(request)

        self.assertEqual(response.status_code, 302)
        self.assertEqual(response['location'], '/lists/the-only-list-in-the-world/')
예제 #17
0
    def test_home_page_returns_correct_html(self):
	
        request = HttpRequest()  # Creating a HttpRequest object

        response = home_page(request)  # Pass the request to home_page view and get a response
		
		self.assertIn('A new list item', response.content.decode())
예제 #18
0
	def test_home_page_returns_correct_html(self):
		#this is what Django will see when a user's browser asks for a page
		request = HttpRequest()
		#pass this request to our home_page view
		response = home_page(request)
		expected_html = render_to_string('home.html')
		self.assertEqual(response.content.decode(), expected_html)
예제 #19
0
파일: tests.py 프로젝트: slhsith/tdd-python
    def test_home_page_returns_correct_html(self):
        request = HttpRequest()                                    # given

        response = home_page(request)                              # when
        expected_html = render_to_string('home.html')

        self.assertEqual(response.content.decode(), expected_html) # then
예제 #20
0
	def test_home_page_returns_correct_html(self):
		request = HttpRequest()
		response = home_page(request)
		expected_html = render_to_string('home.html')
		self.assertEqual(response.content.decode(), expected_html)
		self.assertIn(b'<title>To-Do lists</title>', response.content)
		self.assertTrue(response.content.endswith(b'</html>'))
예제 #21
0
	def test_home_page_returns_correct_html(self):
		request = HttpRequest()
		response = home_page(request)
		self.assertTrue(response.content.startswith(b'<html>'))
		self.assertIn(b'<title>To-Do lists</title>', response.content)
		self.assertTrue(response.content.endswith(b'</html>'))
		
예제 #22
0
	def test_home_page_can_save_a_POST_request(self):
		request = HttpRequest()
		request.method = 'POST'
		request.POST['item_text'] = 'Nuevo Alumno'
		response = home_page(request)
		
		self.assertIn('Nuevo Alumno', response.content.decode())
예제 #23
0
파일: tests.py 프로젝트: pezy/ReadingNotes
 def test_home_page_returns_correct_html(self):
     request = HttpRequest()
     response = home_page(request)
     html = response.content.decode('utf8')
     self.assertTrue(html.startswith('<html>'))
     self.assertIn('<title>To-Do lists</title>', html)
     self.assertTrue(html.endswith('</html>'))
예제 #24
0
	def test_home_page_returns_correct_html(self):
		request = HttpRequest()
		response = home_page(request)
		expected_html = render_to_string(
							'home.html',
							{'new_item_text': 'A new list item'}
						)
예제 #25
0
파일: tests.py 프로젝트: vrst/superlists
    def test_home_page_returns_correct_html(self):
        request = HttpRequest()
        response = home_page(request)

        expected_html = render_to_string('home.html')

        self.assertTrue(response.content.decode(), expected_html)
예제 #26
0
    def test_returns_correct_html(self):
        request = HttpRequest()
        response = home_page(request)

        # Смотрим что нам пришла html-страница с нужным содержимым.
        expected_html = render_to_string('lists/home.html')
        self.assertEqual(response.content.decode(), expected_html)
 def test_home_page_returns_correct_html(self):
     request = HttpRequest()
     response = home_page(request)
     expected_html = render_to_string('home.html', {
         'new_item_text': ''
     })
     self.assertEqual(response.content.decode(), expected_html)
예제 #28
0
	def test_home_page_only_saves_items_when_necessary(self):
		new_list_item_text = 'A new list item'
		(request, rc) = self.setup_request(new_list_item_text, '')

		response = home_page(request)

		self.assertEqual(Item.objects.count(), 0)
예제 #29
0
	def test_home_page_redirects_after_POST(self):
		request = HttpRequest()
		request.method = 'POST'
		request.POST['item_text'] = 'A new list item'
		response = home_page(request)
		self.assertEqual(response.status_code,302)
		self.assertEqual(response['location'],'/')
예제 #30
0
파일: tests.py 프로젝트: jbg2408/superlists
 def test_home_page_returns_correct_html(self):
     # This calls the home_page function, passing a request
     # then checks the returned response for the correct info.
     request = HttpRequest()
     response = home_page(request)
     expected_html = render_to_string('home.html')
     self.assertEqual(response.content.decode(), expected_html)
예제 #31
0
 def test_home_page_is_about_to_do_lists(self):
     request = HttpRequest()
     response = home_page(request)
     self.assertIn("to-do item", response.content.decode())
예제 #32
0
 def testWhenOpenHomepageThenShowRightHtml(self):
     request = HttpRequest()
     response = home_page(request)
     self.assertEqual(render_to_string('home.html'),
                      response.content.decode())
예제 #33
0
 def test_home_page_returns_correct_html(self):
     request = HttpRequest()  #
     response = home_page(request)  #
     self.assertTrue(response.content.startswith(b'<html>'))  #
     self.assertIn(b'<h1>Yogi Perdana</h1>', response.content)
     self.assertTrue(response.content.endswith(b'</html>'))
예제 #34
0
 def test_home_page_returns_correct_html(self):
     request = HttpRequest()
     response = home_page(request)
     assert response.content.startswith(b'<html>')
     assert b'<title>To-Do lists</title>' in response.content
     assert response.content.endswith(b'</html>')
예제 #35
0
 def test_홈페이지는_필요할때만_아이템을_저장해야한다(self): #home_page_only_saves_items_when_necessary(self):
     request = HttpRequest()
     home_page(request)
     self.assertEquals(Item.objects.count(), 0)
예제 #36
0
파일: tests.py 프로젝트: josix/TDD_learning
 def test_home_page_returns_correct_html(self):
     request = HttpRequest(
     )  # create an HttpRequest object, which is what Django will see when a user’s browser asks for a page.
     response = home_page(request)
     expected_html = render_to_string('home.html')
     self.assertEqual(response.content.decode(), expected_html)
예제 #37
0
파일: tests.py 프로젝트: qiwsir/TDDPython
 def test_home_page_returns_correct_html(self):
     request = HttpRequest()
     response = home_page(request)
예제 #38
0
 def test_home_returns_correct_html(self):
     request = HttpRequest()
     response = home_page(request)
     html = response.content.decode('utf8')
     self.assertTrue(html.startswith('<html>'))
     self.assertIn('<title>To-Do lists</title>', html)
예제 #39
0
 def test_home_page_can_save_a_POST_request(self):
     request = HttpRequest()
     request.method = 'POST'
     request.POST['item_text'] = 'A new list item'
     response = home_page(request)
     self.assertIn('A new list item', response.content.decode())
예제 #40
0
	def test_home_page_returns_right_html(self):
		new_list_item_text = 'A new list item'
		(request, rc) = self.setup_request(new_list_item_text, 'POST')

		response = home_page(request)
예제 #41
0
 def test_home_page_html_return_text_muhammad_feril_bagus_p(self):
     request = HttpRequest()
     response = home_page(request)
     html = response.content.decode('utf8')
     self.assertIn('<p class="text_full_name">muhammad feril bagus p</p>',
                   html)
예제 #42
0
 def test_home_page_only_saves_items_when_necessary(self):
     request = HttpRequest()
     home_page(request)
     self.assertEqual(Item.objects.count(), 0)
예제 #43
0
 def test_home_page_returns_correct_html(self):
     request = HttpRequest()
     response = home_page(request)
     expected_html = render_to_string("home.html", request=request)
     self.assertEqual(self.remove_csrf(response.content.decode()),
                      self.remove_csrf(expected_html))
예제 #44
0
 def test_home_page_returns_correct_html(self):
     request = HttpRequest()
     response = home_page(request)
     expected_html = render_to_string('home.html',
                                      {'new_item_text': '신규 작업 아이템'})
예제 #45
0
 def test_home_page_returns_correct_html(self):
     request = HttpRequest()
     response = home_page(request)
     expected_html = render_to_string('home.html', {'form': ItemForm()},
                                      request=request)
     self.assertMultiLineEqual(response.content.decode(), expected_html)
예제 #46
0
 def test_home_page_returns_correct_html(self):
     request = HttpRequest()
     response = home_page(request)
     expected_html = render_to_string('home.html',
                                      {'comment': 'yey, waktunya berlibur'})
     self.assertEqual(response.content.decode(), expected_html)
예제 #47
0
 def test_home_page_returns_correct_html(self):
     request = HttpRequest()
     response = home_page(request)
     expected_html = render_to_string('home.html')
예제 #48
0
 def test_home_page_returns_correct_html(self):
     request = HttpRequest()
     response = home_page(request)
     self.assertNotIn('A new list item', response.content)
예제 #49
0
파일: tests.py 프로젝트: TheZahir/TDD
 def test_home_page_returns_correct_html(self):
     request = HttpRequest()
     response = home_page(request)
     expected_html = render_to_string('home.html')
     self.assertEqual(response.content.decode(), expected_html)
예제 #50
0
 def _home_page_returns_correct_html_via_render_to_string(self):
     request = HttpRequest()
     response = home_page(request)
     html = response.content.decode('utf8')
     expected_html = render_to_string('home.html')
     self.assertEqual(html, expected_html)
예제 #51
0
	def test_home_page_returns_correct_html(self):
		request = HttpRequest()
		response = home_page(request)
		self.assertTrue(response.content.startswith(b'<html>'))
		self.assertIn(b'<title>To-Do lists</title>', response.content)
		self.assertTrue(response.content.strip().endswith(b'</html>'))
예제 #52
0
    def test_no_post(self):
        request = HttpRequest()
        response = home_page(request)

        self.assertEqual(Item.objects.count(), 0)
예제 #53
0
 def test_root_url_resolves_to_home_page_view(self):
     request = HttpRequest()
     response = home_page(request)
     expected_html = render_to_string('home.html')
     print(repr(expected_html))
     self.assertEqual(response.content.decode(), expected_html)
예제 #54
0
 def test_home_page_with_response(self):
     req = HttpRequest()
     res = home_page(req)
     html_page = res.content.decode('utf8')
     self.assertTrue(html_page.startswith("<html>"))
예제 #55
0
 def test_foo_in_body(self):
     request = HttpRequest()
     response = home_page(request)
     html = response.content.decode('utf8')
     self.assertIn('<body><p>foo</p></body>', html)
예제 #56
0
    def test_home_page_returns_correct_html(self):
        request = HttpRequest()
        # print(request) #scheme :http or https,
        # POST:QueryDict:{},path:,method,resolver_match,''' get_host()'''

        response = home_page(request)  # home_page view returns HttpResponse
예제 #57
0
    def test_home_page(self):
        request = HttpRequest()
        response = home_page(request)

        self.assertTrue(response.content.startswith(b'<!doctype html>'))
        self.assertIn(b'<title>To-Do Lists</title>', response.content)
예제 #58
0
파일: test_views.py 프로젝트: wahyuoi/PMPL
 def test_auto_comment(self):
     items = Item.objects.count()
     request = HttpRequest()
     response = home_page(request)
예제 #59
0
파일: tests.py 프로젝트: mayaa2005/webapp
 def test_home_page_returns_correct_html(self):
     request = HttpRequest()
     response = home_page(request)
     expected_html = render_to_string('home.html',
                                      {'new_item_text': 'A new list item'})
     self.assertTrue(1)
예제 #60
0
 def test_home_page_can_store_post_requests(self):
     request = HttpRequest()
     request.method = 'POST'
     request.POST['item_text'] = 'new item'
     response = home_page(request)
     self.assertIn('<td>new item</td>', response.content.decode('utf8'))