Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add ios and android to user_agent provider (#985)
- Loading branch information
Showing
2 changed files
with
78 additions
and
2 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# coding=utf-8 | ||
|
||
from __future__ import unicode_literals | ||
|
||
import unittest | ||
import re | ||
|
||
from faker import Faker | ||
from faker.providers.user_agent import Provider as UaProvider | ||
|
||
|
||
class TestUserAgent(unittest.TestCase): | ||
""" Tests user_agent """ | ||
|
||
def setUp(self): | ||
self.factory = Faker() | ||
self.ua = UaProvider(self.factory) | ||
|
||
def test_android_platform_token(self): | ||
for _ in range(0, 1000): | ||
assert re.match(r"^(Android) (\d+)(\.\d){0,2}", self.ua.android_platform_token()) | ||
|
||
def test_ios_platform_token(self): | ||
for _ in range(0, 1000): | ||
assert re.match(r"^(iPhone|iPad); CPU (iPhone|iPad) OS (\d+)(_\d){0,2} like Mac OS X", | ||
self.ua.ios_platform_token()) |