This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import xml.etree.ElementTree as ET | |
import csv | |
import datetime | |
def convert_xml_to_csv(file_path): | |
with open(file_path, 'rb') as fd: | |
root = ET.parse(fd).getroot() | |
records = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from selenium import webdriver | |
from selenium.webdriver.common.keys import Keys | |
import unittest | |
class NewVistorTest(unittest.TestCase): | |
def setUp(self): | |
self.browser = webdriver.Firefox() | |
self.browser.implicitly_wait(3) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.shortcuts import render | |
from django.http import HttpResponse | |
# Create your views here. | |
def home_page(requests): | |
return HttpResponse('<html><title>To-Do lists</title></html>') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.core.urlresolvers import resolve | |
from django.test import TestCase | |
from django.http import HttpRequest | |
from lists.views import home_page | |
class HomePageTest(TestCase): | |
def test_root_url_solves_to_home_page_view(self): | |
found = resolve('/') | |
self.assertEqual(found.func, home_page) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""superlists URL Configuration | |
The `urlpatterns` list routes URLs to views. For more information please see: | |
https://docs.djangoproject.com/en/1.9/topics/http/urls/ | |
Examples: | |
Function views | |
1. Add an import: from my_app import views | |
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') | |
Class-based views | |
1. Add an import: from other_app.views import Home |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.core.urlresolvers import resolve | |
from django.test import TestCase | |
from lists.views import home_page #1 | |
class HomePageTest(TestCase): | |
def test_root_url_solves_to_home_page_view(self): | |
found = resolve('/') #2 | |
self.assertEqual(found.func, home_page) #3 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.test import TestCase | |
class SmokeTest(TestCase): | |
def test_bad_maths(self): | |
self.assertEqual(1 + 1, 3) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from selenium import webdriver | |
import unittest | |
class NewVistorTest(unittest.TestCase): | |
def setUp(self): #2 | |
self.browser = webdriver.Firefox() | |
self.browser.implicitly_wait(3) | |
def tearDown(self): #3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from selenium import webdriver | |
browser = webdriver.Firefox() | |
# Edith has heard about a cool new onlie to-do app. She goes | |
# to check out its homepage | |
browser.get('localhost:8000') | |
# She notices the page title and header mention to-do lists | |
assert "To-Do" in browser.title |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from selenium import webdriver | |
browser = webdriver.Firefox() | |
browser.get('localhost:8000') | |
assert "Django" in browser.title |
NewerOlder